from selenium import webdriver
from lianxi.xiecheng.base import base
from selenium.webdriver.common.by import By

class hotel_page(base):

    hotel1 = (By.CSS_SELECTOR, '#_allSearchKeyword')#搜索酒店位置
    hotel2 = (By.XPATH, '/html/body/div[2]/div/section/div[2]/ul/li[5]/div/div/div/div[2]/div[2]/div[2]')#点击查看详情
    hotel3 = (By.XPATH, '/html/body/div[2]/div/div[3]/section[1]/div[1]/div[2]/div[2]')#点击选择房间


    url = 'https://www.ctrip.com/' # 网址
    tt1 = '东城区' # 酒店位置
    def hotel(self):
        self.get_url(self.url)
        self.get_sleep()
        self.add_cookie()
        self.get_sx()
        self.get_sleep()
        self.get_text(self.tt1,*self.hotel1)
        self.get_sleep()
        self.get_huiche(*self.hotel1)
        self.get_sleep()
        self.get_jb(-1)
        self.get_gun()
        self.get_sleep()
        self.get_click(*self.hotel2)
        self.get_sleep()
        self.get_jb(-1)
        self.get_click(*self.hotel3)
        self.get_sleep()
